Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Defining a menu bar
You define a menu bar from the bottom up, by defining first the submenus that make up a menu and then the menu itself. In this way, the submenus are already defined when you reference them in the menu bar definition. This is the general syntax for defining a submenu:
Every submenu has a name like any other object, which can be used to identify it.
There are other keywords you can use in menu, submenu, and menu item definitions to define colors, fonts, and other details. Check the online Help for details on these attributes.
If two or more menus share the same elements, you can define one to be
LIKEthe other. This would more likely be the case for a pop-up menu rather than a menu bar, if multiple visual objects share many of the same pop-up menu options.Otherwise, a submenu definition has one or more menu element descriptors. Each of these can be one of the following:
A
RULEinserts a line in the submenu to separate groups of related items. ASKIPsimply leaves an empty line, which can serve the same purpose.If one submenu contains another, you nest one within the other. You must define the innermost submenu first, so that as each submenu is referenced within another submenu or within the main menu bar itself, its name and definition are already identified.
A nested submenu can be initially disabled. Submenus and menu items have a
SENSITIVEattribute just like other objects, which you can set to true or false at run time to enable or disable the submenu or menu item.If you specify a
LABEL, then that string appears as a header for the submenu. Otherwise, the submenu name is used as the default label.Each
menu-item-phraseidentifies a single item that the user can choose from the menu, and has this general syntax:
Each menu item is an object in its own right, with its own name. The
ACCELERATORprovides a shortcut key for selecting the menu item. Like a submenu, it can be initially disabled and can have its own label.If a menu item is marked
READ-ONLY, then it appears in the menu but cannot be chosen. You could use such a menu item as a kind of title for a group of selectable menu items that appear after it.A menu item designated as a
TOGGLE-BOXrepresents a logical value. Each time you select it its logical true/false value is reversed and a check box appears or disappears in front of the label to indicate this. TheCHECKEDattribute tells you at run time whether the item is currently checked or not.You can define a
CHOOSEevent trigger phrase in place of a menu item or you can define anON CHOOSEblock in the procedure following the menu definition.Once you’ve defined all the submenus your menu bar needs, you define the menu bar itself:
Use the
MENUBARkeyword to identify that this is a menu bar for a window and not a pop-up menu. The menu element descriptors for the menu itself can be submenus and menu items, but not rules or skips.Assigning a menu bar to a window
To assign a menu bar to a window, you set the
MENUBARattribute of the window to the menu bar’s handle:
Typically, you have to identify a menu name by preceding it with the
MENUkeyword as in this example. You identify a submenu using theMENUorSUB-MENUkeyword. You identify a menu item by preceding it with theMENU-ITEMkeyword.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |